/*******************************************************************************
* Copyright (c) 2010, 2018 西安秦晔信息科技有限公司
* Licensed under the Apache License, Version 2.0 (the "License");
*    you may not use this file except in compliance with the License.
*    You may obtain a copy of the License at
*
*       http://www.apache.org/licenses/LICENSE-2.0
*
*    Unless required by applicable law or agreed to in writing, software
*    distributed under the License is distributed on an "AS IS" BASIS,
*    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*    See the License for the specific language governing permissions and
*    limitations under the License.
*******************************************************************************/
package com.qinyeit.serviceapp.entity;

import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.qinyeit.serviceapp.entity.enums.*;
import lombok.Builder;
import lombok.experimental.Tolerate;

import javax.persistence.*;
import java.util.List;
import java.util.Map;

/**
 * ClassName: Dishes <br/>
 * Function: 菜品 <br/>
 * date: 2018-11-23 11:45:37 <br/>
 *
 * @author liuwenjin
 * @version  1.0
 * @since JDK 1.8
 */
@Builder
@Entity
@Table(name="dishess")
public class Dishes extends MerchantGroupBaseEntity<Long> {

	private static final long serialVersionUID = 1L;

	// 菜品库 
    @Column(name="store_id")
	private Long storeId = null;

	// 名称 
    @Column(name="name", length = 300)
	private String name = null;

	// 快捷码 
    @Column(name="spell", length = 300)
	private String spell = null;

	// 拼音号码 
    @Column(name="pinyin", length = 300)
	private String pinyin = null;

	// 菜品编码 
    @Column(name="no", length = 300)
	private String no = null;

	// 英文名称 
    @Column(name="name_en", length = 300)
	private String nameEn = null;

	// 所属菜类
	@ManyToOne
	@JoinColumn(name="category_id")
	private DishesCategory category = null;

	// 菜品单位
	@Column(name="unit")
	private String unit = null;

	// 是否是称重菜 
    @Column(name="weigh")
	private Boolean weigh = false;

	// 是否是时价菜 
    @Column(name="season")
	private Boolean season = false;

	// 菜品打印大类 
    @Column(name="print_category_id")
	private Long printCategoryId = null;

	// 是否提成 
    @Column(name="commission")
	private Boolean commission = false;

	// 提成类型 
    @Column(name="commission_type", length = 300)
	@Enumerated(EnumType.STRING)
	private DishesCommissionType commissionType = DishesCommissionType.PROPORTION;

	// 提成值 
    @Column(name="commission_value",scale=2)
	private Double commissionValue = 0.00;

	// 预估成本 
    @Column(name="future_cost",scale=2)
	private Double futureCost = 0.00;

	// 菜品价格 
    @Column(name="price",scale=2)
	private Double price = 0.00;

	// 会员价格 
    @Column(name="vip_price",scale=2)
	private Double vipPrice = 0.00;

	// 热度 
    @Column(name="hot")
	private Integer hot = 0;

	// 推荐度 
    @Column(name="recommend")
	private Integer recommend = 0;

	// 菜品图片 
    @Column(name="img", length = 300)
	private String img = null;

	// 简介 
    @Column(name="introduction", length = 2000)
	private String introduction = null;

	// 状态(在售/停售) 
    @Column(name="state", length = 300)
	@Enumerated(EnumType.STRING)
	private DishesState state = DishesState.NORMAL;

	// 是否参与销量排行 
    @Column(name="rank")
	private Boolean rank = false;

	// 类型 
    @Column(name="type", length = 300)
	@Enumerated(EnumType.STRING)
	private DishesType type = DishesType.DISHES;

	// 套餐类型 
    @Column(name="pack_type", length = 300)
	@Enumerated(EnumType.STRING)
	private PackageType packType = PackageType.EASYPACKAGE;

	// 定价模式 
    @Column(name="price_mode", length = 300)
	@Enumerated(EnumType.STRING)
	private PriceMode priceMode = PriceMode.FIXEDPRICE;

	// 起售数
	@Column(name="sale_number")
	private Integer saleNumber = 0;

	//创建的时候生成 编辑的时候不变
	@Column(name="uuid", length = 300)
	private String uuid = "";

	//更新的时间戳 long
	@Column(name="update_timestamp")
	private Long updateTimestamp = null;

	//原料id
	@Column(name="material_id")
	private Long materialId = null;


	//商品条码 （零售和生鲜行业使用）
	@Column(name="code")
	private String code = null;
	//是否下发过 默认没有下发过
	@Column(name="has_issue")
	private Boolean hasIssue = false;

	//品牌
	@Column(name="brand_id")
	private Long brandId = null;

	//进项税
	@Column(name = "input_tax")
	private Double inputTax = 0d;

	//销项税
	@Column(name = "output_tax")
	private Double outputTax = 0d;

	//商品类型
	@Column(name = "good_type")
	private String goodType = "";

	//扩展字段
	@Column(name = "extend", columnDefinition = "mediumtext")
	private String extend = "";



	@Transient
	private JSONArray specificationRelations = null;
	@Transient
	private JSONArray makeRelations = null;
	@Transient
	private JSONArray feedRelations = null;

	@Transient
	private Long count = null;

    @Tolerate
	public Dishes() {
		
	}

    @Tolerate
	public Dishes(Long id){
    	super.setId(id);
    }

	public String getUnit() {
		return unit;
	}

	public Integer getSaleNumber() {
		return saleNumber;
	}

	public void setSaleNumber(Integer saleNumber) {
		this.saleNumber = saleNumber;
	}

	/**
	 * 获取菜品库
	 */
	public Long getStoreId() {
		return this.storeId;
	}

    /**
     * 设置菜品库
     */
	public Dishes setStoreId(Long storeId) {
		this.storeId = storeId;
		return this;
	}

	public Boolean getHasIssue() {
		return hasIssue;
	}

	public void setHasIssue(Boolean hasIssue) {
		this.hasIssue = hasIssue;
	}

	/**
	 * 获取名称
	 */
	public String getName() {
		return this.name;
	}

    /**
     * 设置名称
     */
	public Dishes setName(String name) {
		this.name = name;
		return this;
	}

	/**
	 * 获取快捷码
	 */
	public String getSpell() {
		return this.spell;
	}

    /**
     * 设置快捷码
     */
	public Dishes setSpell(String spell) {
		this.spell = spell;
		return this;
	}

	/**
	 * 获取拼音号码
	 */
	public String getPinyin() {
		return this.pinyin;
	}

    /**
     * 设置拼音号码
     */
	public Dishes setPinyin(String pinyin) {
		this.pinyin = pinyin;
		return this;
	}

	/**
	 * 获取菜品编码
	 */
	public String getNo() {
		return this.no;
	}

    /**
     * 设置菜品编码
     */
	public Dishes setNo(String no) {
		this.no = no;
		return this;
	}

	/**
	 * 获取英文名称
	 */
	public String getNameEn() {
		return this.nameEn;
	}

    /**
     * 设置英文名称
     */
	public Dishes setNameEn(String nameEn) {
		this.nameEn = nameEn;
		return this;
	}


	/**
	 * 获取是否是称重菜
	 */
	public Boolean getWeigh() {
		return this.weigh;
	}

    /**
     * 设置是否是称重菜
     */
	public Dishes setWeigh(Boolean weigh) {
		this.weigh = weigh;
		return this;
	}

	/**
	 * 获取是否是时价菜
	 */
	public Boolean getSeason() {
		return this.season;
	}

    /**
     * 设置是否是时价菜
     */
	public Dishes setSeason(Boolean season) {
		this.season = season;
		return this;
	}

	/**
	 * 获取菜品打印大类
	 */
	public Long getPrintCategoryId() {
		return this.printCategoryId;
	}

    /**
     * 设置菜品打印大类
     */
	public Dishes setPrintCategoryId(Long printCategoryId) {
		this.printCategoryId = printCategoryId;
		return this;
	}

	/**
	 * 获取是否提成
	 */
	public Boolean getCommission() {
		return this.commission;
	}

    /**
     * 设置是否提成
     */
	public Dishes setCommission(Boolean commission) {
		this.commission = commission;
		return this;
	}



	/**
	 * 获取提成值
	 */
	public Double getCommissionValue() {
		return this.commissionValue;
	}

    /**
     * 设置提成值
     */
	public Dishes setCommissionValue(Double commissionValue) {
		this.commissionValue = commissionValue;
		return this;
	}

	/**
	 * 获取预估成本
	 */
	public Double getFutureCost() {
		return this.futureCost;
	}

    /**
     * 设置预估成本
     */
	public Dishes setFutureCost(Double futureCost) {
		this.futureCost = futureCost;
		return this;
	}

	/**
	 * 获取菜品价格
	 */
	public Double getPrice() {
		return this.price;
	}

    /**
     * 设置菜品价格
     */
	public Dishes setPrice(Double price) {
		this.price = price;
		return this;
	}

	/**
	 * 获取会员价格
	 */
	public Double getVipPrice() {
		return this.vipPrice;
	}

    /**
     * 设置会员价格
     */
	public Dishes setVipPrice(Double vipPrice) {
		this.vipPrice = vipPrice;
		return this;
	}

	/**
	 * 获取热度
	 */
	public Integer getHot() {
		return this.hot;
	}

    /**
     * 设置热度
     */
	public Dishes setHot(Integer hot) {
		this.hot = hot;
		return this;
	}

	/**
	 * 获取推荐度
	 */
	public Integer getRecommend() {
		return this.recommend;
	}

    /**
     * 设置推荐度
     */
	public Dishes setRecommend(Integer recommend) {
		this.recommend = recommend;
		return this;
	}

	/**
	 * 获取菜品图片
	 */
	public String getImg() {
		return this.img;
	}

    /**
     * 设置菜品图片
     */
	public Dishes setImg(String img) {
		this.img = img;
		return this;
	}

	/**
	 * 获取简介
	 */
	public String getIntroduction() {
		return this.introduction;
	}

    /**
     * 设置简介
     */
	public Dishes setIntroduction(String introduction) {
		this.introduction = introduction;
		return this;
	}



	/**
	 * 获取是否参与销量排行
	 */
	public Boolean getRank() {
		return this.rank;
	}

    /**
     * 设置是否参与销量排行
     */
	public Dishes setRank(Boolean rank) {
		this.rank = rank;
		return this;
	}

	public DishesCategory getCategory() {
		return category;
	}

	public void setCategory(DishesCategory category) {
		this.category = category;
	}


	public DishesCommissionType getCommissionType() {
		return commissionType;
	}

	public void setCommissionType(DishesCommissionType commissionType) {
		this.commissionType = commissionType;
	}

	public DishesState getState() {
		return state;
	}

	public void setState(DishesState state) {
		this.state = state;
	}

	public DishesType getType() {
		return type;
	}

	public void setType(DishesType type) {
		this.type = type;
	}

	public PackageType getPackType() {
		return packType;
	}

	public void setPackType(PackageType packType) {
		this.packType = packType;
	}

	public PriceMode getPriceMode() {
		return priceMode;
	}

	public void setPriceMode(PriceMode priceMode) {
		this.priceMode = priceMode;
	}

	public void setUnit(String unit) {
		this.unit = unit;
	}

	public JSONArray getSpecificationRelations() {
		return specificationRelations;
	}

	public void setSpecificationRelations(JSONArray specificationRelations) {
		this.specificationRelations = specificationRelations;
	}

	public JSONArray getMakeRelations() {
		return makeRelations;
	}

	public void setMakeRelations(JSONArray makeRelations) {
		this.makeRelations = makeRelations;
	}

	public JSONArray getFeedRelations() {
		return feedRelations;
	}

	public void setFeedRelations(JSONArray feedRelations) {
		this.feedRelations = feedRelations;
	}

	public String getUuid() {
		return uuid;
	}

	public void setUuid(String uuid) {
		this.uuid = uuid;
	}

	public Long getUpdateTimestamp() {
		return updateTimestamp;
	}

	public void setUpdateTimestamp(Long updateTimestamp) {
		this.updateTimestamp = updateTimestamp;
	}

	public Long getMaterialId() {
		return materialId;
	}

	public void setMaterialId(Long materialId) {
		this.materialId = materialId;
	}

	public String getCode() {
		return code;
	}

	public void setCode(String code) {
		this.code = code;
	}

	public Long getBrandId() {
		return brandId;
	}

	public void setBrandId(Long brandId) {
		this.brandId = brandId;
	}

	public Double getInputTax() {
		return inputTax;
	}

	public void setInputTax(Double inputTax) {
		this.inputTax = inputTax;
	}

	public Double getOutputTax() {
		return outputTax;
	}

	public void setOutputTax(Double outputTax) {
		this.outputTax = outputTax;
	}

	public String getGoodType() {
		return goodType;
	}

	public void setGoodType(String goodType) {
		this.goodType = goodType;
	}

	public String getExtend() {
		return extend;
	}

	public void setExtend(String extend) {
		this.extend = extend;
	}

	public Long getCount() {
		return count;
	}

	public void setCount(Long count) {
		this.count = count;
	}
}
